-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix balance behavior for selfdestructed accounts #1526
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codchen
force-pushed
the
selfdestruct-balance-behavior
branch
from
April 10, 2024 02:25
129b158
to
28fee50
Compare
codchen
changed the title
Emit event for contract registration (#1518)
Fix balance behavior for selfdestructed accounts
Apr 10, 2024
Comment on lines
+113
to
+126
for a, status := range st.transientAccounts { | ||
if !bytes.Equal(status, AccountDeleted) { | ||
continue | ||
} | ||
acc := common.HexToAddress(a) | ||
residual := s.GetBalance(acc) | ||
if residual.Cmp(utils.Big0) == 0 { | ||
continue | ||
} | ||
s.SubBalance(acc, residual, tracing.BalanceDecreaseSelfdestructBurn) | ||
// we don't want to really "burn" the token since it will mess up | ||
// total supply calculation, so we send them to fee collector instead | ||
s.AddBalance(s.coinbaseEvmAddress, residual, tracing.BalanceDecreaseSelfdestructBurn) | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
Iteration over map may be a possible source of non-determinism
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## seiv2 #1526 +/- ##
==========================================
+ Coverage 60.12% 60.44% +0.32%
==========================================
Files 365 365
Lines 25833 25843 +10
==========================================
+ Hits 15532 15621 +89
+ Misses 9314 9233 -81
- Partials 987 989 +2
|
codchen
force-pushed
the
selfdestruct-balance-behavior
branch
from
April 10, 2024 04:07
28fee50
to
a6208c9
Compare
Kbhat1
approved these changes
Apr 10, 2024
codchen
force-pushed
the
selfdestruct-balance-behavior
branch
from
April 10, 2024 14:47
a6208c9
to
82a5630
Compare
codchen
force-pushed
the
selfdestruct-balance-behavior
branch
from
April 11, 2024 03:32
82a5630
to
6fc9540
Compare
udpatil
pushed a commit
that referenced
this pull request
Apr 17, 2024
Emit event for contract registration (#1518)
udpatil
pushed a commit
that referenced
this pull request
Apr 17, 2024
Emit event for contract registration (#1518)
udpatil
pushed a commit
that referenced
this pull request
Apr 17, 2024
Emit event for contract registration (#1518)
udpatil
pushed a commit
that referenced
this pull request
Apr 18, 2024
Emit event for contract registration (#1518)
udpatil
pushed a commit
that referenced
this pull request
Apr 19, 2024
Emit event for contract registration (#1518)
udpatil
pushed a commit
that referenced
this pull request
Apr 19, 2024
Emit event for contract registration (#1518)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes and provide context
Instead of ignoring balance changes to self-destructed accounts in the same block, we want to keep track of the balance changes (just in case the account is recreated in the same block) and burn any remaining tokens at the end of the transaction
Testing performed to validate your change
unit test